<template>
  <div class="agreementList">
    <ul>
      <li @click="tosth(item.id)" v-for="(item, i) in list" :key="i">
        {{ item.name }}<van-icon name="arrow" class="arrow" />
      </li>
    </ul>
  </div>
</template>

<script>
import {getCourses} from '@/assets/js/api';
export default {
  data() {
    return {
      userId: localStorage.userId,
      list: [
        {
          id: 1,
          name: '理财进阶课'
        }
      ]
    };
  },
  methods: {
    tosth(v) {
      getCourses(this.userId, false).then(data => {
        if (data[1].length === 0) {
          this.$toast('您没有购买课程');
        } else {
          this.$router.push({
            path: '/agreementDetail',
            query: {
              id: v
            }
          });
        }
      });
    }
  }
};
</script>

<style lang="less" scoped>
.agreementList {
  background: #ffffff;
  height: 100vh;
  ul {
    li {
      height: 100px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #cccccc;
      &:not(:last-child) {
      }
      font-size: 30px;
      padding: 0 30px;
    }
  }
}
</style>
